//package com.finger.hospservice.receiver;
//
//import com.finger.hospservice.service.ScheduleService;
//import com.finger.modelservice.model.hosp.Schedule;
//import com.finger.modelservice.vo.msm.MsmVo;
//import com.finger.modelservice.vo.order.OrderMqVo;
//import org.springframework.beans.factory.annotation.Autowired;
//
//
//import java.io.IOException;
//
////@Component
//public class HospitalReceiver {
//
//    @Autowired
//    private ScheduleService scheduleService;
//
//    @Autowired
//    private RabbitService rabbitService;
//
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(value = MqConst.QUEUE_ORDER, durable = "true"),
//            exchange = @Exchange(value = MqConst.EXCHANGE_DIRECT_ORDER),
//            key = {MqConst.ROUTING_ORDER}
//    ))
//    public void receiver(OrderMqVo orderMqVo, Message message, Channel channel) throws IOException {
//        //下单成功更新预约数
//        Schedule schedule = scheduleService.findScheduleById(orderMqVo.getScheduleId());
//        schedule.setReservedNumber(orderMqVo.getReservedNumber());
//        schedule.setAvailableNumber(orderMqVo.getAvailableNumber());
//        scheduleService.update(schedule);
//        //发送短信
//        MsmVo msmVo = orderMqVo.getMsmVo();
//        if(null != msmVo) {
//            rabbitService.sendMessage(MqConst.EXCHANGE_DIRECT_MSM, MqConst.ROUTING_MSM_ITEM, msmVo);
//        }
//    }
//}
